<template>
	<view class="content">
		<view class="goodsImg">
			<u--image :showLoading="true" :src="info.product_img" mode="widthFix" width="100%"
				height="750rpx"></u--image>
		</view>
		<view class="goodstitle">
			<view class="money">
				￥{{info.product_price}}
			</view>
			<view class="name">
				{{info.product_name}}
			</view>
		</view>
		<view class="detail">
			宝贝详情
		</view>
		<view class="detailimg">
			<image style="width: 100%;" mode="widthFix" :src="info.content"></image>
		</view>
		<view class="pay-btn">
			<view class="btn" @click="goSettlement(info.product_id)">
				立即购买
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				minisystemInfo: '',
				id: ''
			}
		},
		onLoad(e) {
			this.id = e.id
			this.getProductInfo(e.id)
			uni.getStorage({
				key: 'minisystemInfo',
				success: (res) => {
					this.minisystemInfo = res.data
				}
			})
		},
		onShareAppMessage(e) {
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let currentPage = routes[routes.length - 1].route;
			let shareobj = {
				title: this.minisystemInfo.sub_title, //分享的标题
				path: currentPage + '?id=' + this.id, //好友点击分享之后跳转的页面
				imageUrl: this.minisystemInfo.url, //内容图片
			}
			return shareobj //一定要返回对象
		},
		methods: {
			getProductInfo(id) {
				this.$api.productinfo({
					id
				}).then(res => {
					this.info = res.data
				})
			},
			goSettlement(id) {
				uni.navigateTo({
					url: '/subpackageB/productdetails/settlement?id=' + id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		min-height: 100vh;
		z-index: -1;
		background-color: #FEF1DC;
		padding-bottom: 124rpx;
	}

	.goodstitle {
		padding: 40rpx;
	}

	.goodstitle {
		.money {
			font-family: PingFangSC, PingFang SC;
			font-weight: 500;
			font-size: 36rpx;
			color: #D06122;
			line-height: 50rpx;
			text-align: left;
			font-style: normal;
		}

		.name {
			padding-top: 10rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #111111;
			line-height: 44rpx;
			text-align: left;
			font-style: normal;
		}
	}

	.detail {
		padding: 20rpx 0 40rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #AAAAAA;
		line-height: 40rpx;
		text-align: center;
		font-style: normal;
	}

	.pay-btn {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 124rpx;
		background: #FEF1DC;
		display: flex;
		justify-content: center;
		align-items: center;

		.btn {
			width: 690rpx;
			height: 84rpx;
			background: linear-gradient(270deg, #EA6F29 0%, #FAAA7D 100%);
			border-radius: 42rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 500;
			font-size: 30rpx;
			color: #FFFFFF;
			line-height: 84rpx;
			text-align: center;
			font-style: normal;
		}
	}
</style>